AddCSLuaFile()

DEFINE_BASECLASS( "class_default" )

local PLAYER = {}

PLAYER.DisplayName			= "Bear"

PLAYER.DefaultWalkSpeed = 180
PLAYER.WalkSpeed = 180
PLAYER.MaxHealth			= 250
PLAYER.StartHealth			= 250

PLAYER.WeaponDamageMin = 10
PLAYER.WeaponDamageMax = 15

PLAYER.ResourceAmount = 0
PLAYER.ResourceMax = 3
PLAYER.RegenTime = 0
PLAYER.RegenAmount = 0
PLAYER.ResourceColor = Color(205, 205, 15, 255)

function PLAYER:SetupDataTables()

	BaseClass.SetupDataTables( self )

end

function PLAYER:Spawn()
	print(self.HoldType)
	self.Player:StripWeapons()
	self.Player.Parry = 0.1
	self.Player.Dodge = 0.1
	self.Player.Block = 0.0
	self.Player.ArmorStat = 4
	local col = team.GetColor(self.Player:Team())
	self.Player:SetRenderMode(RENDERMODE_TRANSALPHA)
	self.Player:SetColor( Color(0, 0, 0, 0) )
	self.Player:SetPlayerColor( Vector(	col.r/255, col.g/255, col.b/255 ) )
	self.Player:SetWeaponColor( Vector( col.r/255, col.g/255, col.b/255 ) )
	self.Player:SetWalkSpeed(self.WalkSpeed)
	self:Loadout()
	net.Start("SendSelfMaxHealth")
	net.WriteFloat(self.MaxHealth)
	net.Send(self.Player)
end

function PLAYER:Loadout()
	
	if(self.Player.Bear != nil)then
		self.Player.Bear:Remove()
		self.Player.Bear = nil
	end
	
	self.Player.Bear = ents.Create("rpgdm_player_bear")
	self.Player.Bear:PhysicsInit(SOLID_NONE)
	self.Player.Bear:SetMoveType(MOVETYPE_NONE)
	self.Player.Bear:SetSolid( SOLID_NONE )
	self.Player.Bear:SetPos(self.Player:GetPos())
	self.Player.Bear:Spawn()
	self.Player.Bear:Activate()
	self.Player.Bear.Follow = self.Player
	
	self.Player:Give( "weapon_all" )
	local weapon = self.Player:GetWeapon("weapon_all")
	
	net.Start("SendBear")
	net.WriteTable({self.Player:EntIndex(), self.Player.Bear:EntIndex()})
	net.Broadcast()
		
	weapon.MinWeaponDamage = self.WeaponDamageMin
	weapon.MaxWeaponDamage = self.WeaponDamageMax
end

function PLAYER:OnHit(target)
	target:EmitSound("devin/blackbetty/weapons/2HMaceHitPlateCrit.wav", 150, 100+math.random(-10,-30))
	target:SetVelocity((((self.Player:GetPos()) - target:GetPos())*-2))
	ParticleEffect( "blood_erupt", target:GetPos() + Vector(0, 0, 46) + (target:GetAngles():Forward()*7), Angle(0,0,0), target )
end

player_manager.RegisterClass( "class_bear", PLAYER, "class_default" )